#define _CRT_SECURE_NO_WARNINGS 1

#include <string>
#include <vector>
#include <algorithm>
using namespace std;

class Solution {
public:
    string largestNumber(vector<int>& nums) {
        vector<string> order;
        for (auto e : nums)
            order.push_back(to_string(e));
        sort(order.begin(), order.end(), [](string& s1, string& s2)->bool {
            return s1 + s2 > s2 + s1;
            });
        string ret;
        for (auto& str : order)
            ret += str;
        if (ret[0] == '0') return "0";
        return ret;
    }
};